//
//  YWInspectionEquipmentRecord.m
//  maintain
//
//  Created by Kyo on 16/5/26.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWInspectionEquipmentRecord.h"
#import "MJExtension.h"
#import "YWLocation.h"
#import "YWEquipment.h"

@implementation YWInspectionEquipmentRecord
+ (NSDictionary*)mj_replacedKeyFromPropertyName
{
    return @{ @"status" : @"resultCode",
              @"posTroubleArray" : @"troubles"};
}
+ (NSDictionary*)mj_objectClassInArray
{
    return @{ @"pictures" : @"YWPatrolPicture",
              @"equipmentFields" : @"YWEquipmentFieldRecord",
              @"posTroubleArray" : @"YWTroubleIdJson"};
}
- (void)mj_keyValuesDidFinishConvertingToObject{
    if (self.location) {
        self.locationId = self.location.locationId;
    }
    if (self.equipment) {
        self.equipmentId = self.equipment.equipmentId;
    }
}
@end

@implementation YWInspectionEquipmentRecordJson
+ (NSDictionary*)mj_objectClassInArray
{
    return @{ @"equipmentRecords" : @"YWInspectionEquipmentRecord",
              @"locationRecords" : @"YWInspectionEquipmentRecord"};
}
+ (NSArray *)mj_ignoredPropertyNames{
    return @[@"allKindRecord"];
}
- (void)mj_keyValuesDidFinishConvertingToObject{
    self.allKindRecord = [NSMutableArray array];
    [_allKindRecord addObjectsFromArray:_equipmentRecords];
    [_allKindRecord addObjectsFromArray:_locationRecords];
}
@end

@implementation YWInspectionLocationRecordJson
+ (NSDictionary*)mj_replacedKeyFromPropertyName
{
    return @{ @"status" : @"resultCode",
              @"posTroubleArray" : @"troubles"};
}
+ (NSDictionary*)mj_objectClassInArray
{
    return @{ @"pictures" : @"YWPatrolPicture",
              @"posTroubleArray" : @"YWTroubleIdJson"};
}

@end
